<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // padStart() 方法用另一个字符串填充当前字符串(如果需要的话，会重复多次)，
        // 以便产生的字符串达到给定的长度。
        // 从当前字符串的左侧开始填充。

        let str1 = '5';
        let str2 = str1.padStart(2, '0')
        let str3 = str1.padStart(5, '0')
        console.log(str2);
        console.log(str3);

        let str4 = 'hello';
        let str5 = str4.padStart(6, "*")
        console.log(str5);

        console.log('abc'.padStart(10));
        console.log('abc'.padStart(10, '520'));
    </script>
</body>
</html>